<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <p>{{num}}</p>
      <button @click="num++">按钮+</button>
    </div>
    <script src="./js/vue.js"></script>
    <script>
      const vm = new Vue({
        // 方法：函数数据
        methods: {},
        watch: {
          // 监视
          num: {
            handler(newVal, oldVal) {
              console.log(newVal, oldVal);
            },
            immediate: true,
            // deep: true,
          },
        },
        data: {
          num: 0,
        },
      });
      vm.$mount("#app");
    </script>
  </body>
</html>
